<?php 


class referee
{
	protected $_pageManager	= null;	
	protected $_layout 		= null;
	protected $_lang		= null;
	
	function __construct(){
		$this->_layout = new layout();
	}
	
	public function setLanguage($lang){
		$this->_lang = $lang;
	}
	
	public function setPageManager($pageManager){
		$this->_pageManager = $pageManager;
	}
	
	public function makeAction(){
		if (isset($_POST['action'])){
			$this->_pageManager->manageAction($_POST);
			if (!$this->_pageManager->isValid()){
				$this->_layout->setError($this->_pageManager->getErrorMessage());
			}
		}
		$this->_pageManager->manageVisible();
	}
	
	public function makeVisible(){
		$this->_layout->setLanguage($this->_lang);
		$this->_layout->setContent ($this->_pageManager->getVisibile());
		$this->_layout->setTitle ($this->_pageManager->getTitle());
		return $this->_layout->getPage(); 
	}
	
}

?>